package com.nl.lib_project.view.radar

import android.annotation.SuppressLint
import android.graphics.Color
import androidx.annotation.ColorInt

/** @author changhai qiu Email:qstumn@163.com */
open class RadarData(
    private var mValue: ArrayList<Float>,
    @SuppressLint("ResourceAsColor") @ColorInt var color: Int = Color.TRANSPARENT
) {
  private var mValueText: ArrayList<String>? = null
  var lineWidth: Float
  var valueTextColor: Int
  var valueTextSize: Float
  var isValueTextEnable: Boolean
  var isFillRadarColor: Boolean = false

  var value: ArrayList<Float>
    get() = mValue
    set(value) {
      mValue = value
      initValueText()
    }
  val valueText: List<String>?
    get() = mValueText

  fun setValueText(mValueText: ArrayList<String>?) {
    this.mValueText = mValueText
  }

  fun isFillRadarColor(flag: Boolean) {
    this.isFillRadarColor = flag
  }

  private fun initValueText() {
    mValueText = ArrayList()
    for (i in mValue.indices) {
      mValueText!!.add(mValue[i].toString())
    }
  }

  init {
    initValueText()
    valueTextColor = -0x616162
    valueTextSize = 30f
    lineWidth = 1f
    isValueTextEnable = false
  }
}
